#include "Trash.h"
#include "gamemap.h"

Trash::Trash(GridVec pos, int name, int direction)
    : Building(pos, name, direction)
{

}

bool Trash::IsPlace(const GridVec &click, int picdirection, GameMap &gamemap)
{
    // 如果超出地图范围，返回false
    if (pos.i < 0 || pos.i >= GameInfo::HEIGHT || pos.j < 0 || pos.j >= GameInfo::WIDTH)
    {
        return false;
    }
    // 如果在矿地上，或有障碍物，返回false
    if (gamemap.GetResource(pos))
    {
        return false;
    }
    // 如果点击的是hub，返回false
    if (gamemap.GetBuilding(pos))
    {
        if (gamemap.GetBuilding(pos)->name == BuildingType::HUB || gamemap.GetBuilding(pos)->name == BuildingType::CUTTER || gamemap.GetBuilding(pos)->name == BuildingType::TRASH)
        {
            return false;
        }
    }
    return true;
}

std::vector<GridVec> Trash::BuildingAllPos()
{
    std::vector<GridVec> result = {pos};
    return result;
}

void Trash::Receive(GridVec source, int directionin, int shapename)
{
    return;
}

bool Trash::CanReceive(GridVec source, int directionin, int shapename)
{
    return true;
}

void Trash::TickableRunning()
{
    return;
}

void Trash::UpdateTickableState(GameMap &gamemap)
{
    return;
}
